{include file="../application/admin/view/common/header.html" /}


<!--main content start-->
<section class="main-content">
    <!--start page content-->

    <div class="row">

        <div class="col-md-12">
            <div class="panel panel-default collapsed">
                <div class="panel-heading">
                    <div class="float-m" style="display: inline-block;">
                        <label>日期范围:</label>
                        <input type="text" id="logmin" class="input-text Wdate"
                               style="width:120px;display: inline-block;">
                        -
                        <input type="text" id="logmax" class="input-text Wdate"
                               style="width:120px;display: inline-block;">
                    </div>
                    <div class="search-form">
                        <input type="text" class="form-control" placeholder="搜索管理员名称/手机/邮箱"/>
                        <button type="button" id="submit" class="btn-search"><i class="fa fa-search"></i></button>
                    </div>
                </div>
                <div class="panel-body">

                    <table class="table table-hover table-striped table-bordered" data-page-size="12"
                           data-filter=#filter>
                        <thead>
                        <tr>
                            <th>日志ID</th>
                            <th>操作人</th>
                            <th>日志类型</th>
                            <th>操作模块</th>
                            <th>操作内容</th>
                            <th>更新时间</th>
                            <th>访问ip</th>
                        </tr>
                        </thead>
                        <tbody>


                        </tbody>
                    </table>
                    <div class="pager" id="page" style="text-align: right;"></div>
                </div>
            </div>
        </div>
    </div><!--end row-->

    <!--end page content-->


    <!-- <footer class="footer">
        <span></span>
    </footer> -->


</section>
<!--end main content-->


<!--Common plugins-->
<script src="_JS_/jquery.min.js"></script>
<script src="_JS_/jquery.base64.js"></script>
<script src="_JS_/jquery.cookie.js"></script>
<script src="_JS_/bootstrap.min.js"></script>
<script src="_JS_/jasny-bootstrap.min.js"></script>
<script src="_JS_/jquery.slimscroll.min.js"></script>
<script src="_JS_/jquery.nanoscroller.min.js"></script>
<script src="_JS_/metismenu.min.js"></script>
<script src="_JS_/float-custom.js"></script>
<script type="text/javascript" src="_JS_/layer/layer.js"></script>
<script type="text/javascript" src="_JS_/laypage/laypage.js"></script>
<script type="text/javascript" src="_JS_/laydata/laydate.js"></script>
<script type="text/javascript" src="_JS_/getMyDate.js"></script>
<!-- <script src="js/footable.all.min.js"></script> -->
<!-- Page-Level Scripts -->
<script>


    $(function () {
        $("#page-title").html("会员日志管理");
        postfile(1);
    })


    function postfile(page) {
        var logmin = $("#logmin").val();
        var logmax = $("#logmax").val();
        var username = $(".search-form input").val();
        $.ajax({
            type: 'GET',
            url: "{:url('api/log/ment_list')}",
            dataType: 'jsonp',
            jsonp: 'callback',
            data: {'page': page, 'logmin': logmin, 'logmax': logmax, 'username': username},
            beforeSend: function () {
                var index = layer.load(1, {
                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                });
            },
            success: function (msg) {
                layer.closeAll();
                $("#log_management").addClass("active").children("ul").addClass("in");
                $("#log_ment").addClass("choose");
                if (msg.code == 200) {
                    var pages = Math.ceil(msg.data.count / 10);
                    $(".table tbody").html("");
                    if (msg.data.data.length > 0) {
                        for (var i = 0; i < msg.data.data.length; i++) {
                            var time = msg.data.data[i].time;
                            ltime = getMyDate(time * 1000);

                            var html = '<tr id="' + msg.data.data[i].id + '"><td>' + msg.data.data[i].id + '</td>' +
                                '<td>' + msg.data.data[i].name + '</td>' +
                                '<td>' + msg.data.data[i].category + '</td><td>' + msg.data.data[i].controller + '</td>' +
                                '<td>' + msg.data.data[i].content + '</td><td>' + ltime + '</td><td>' + msg.data.data[i].ip + '</td>' +
                                '</tr>';
                            $(".table tbody").append(html);
                        }
                    }
                    //分页
                    $(".table").attr("pages", page);
                    laypage({
                        cont: 'page',
                        pages: pages,
                        curr: page,
                        jump: function (obj, first) {
                            if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                                postfile(obj.curr);
                            }
                        }
                    })
                } else {
                    layer.msg(msg.message, {icon: 5, time: 2000});
                }
            }
        })
    }


    // 搜索
    $('#submit').click(function () {
        postfile(1);
    })

    //回车键绑定搜索
    $(".search-form").keydown(function (event) {
        if (event.keyCode == 13) {
            postfile(1);
        }
    });


    //日期范围限制
    var start = {
        elem: '#logmin',
        format: 'YYYY-MM-DD',
        min: '1970-01-01', //设定最小日期为当前日期
        max: laydate.now(), //最大日期
        istime: false,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };

    var end = {
        elem: '#logmax',
        format: 'YYYY-MM-DD',
        min: '1970-01-01',
        max: laydate.now(),
        istime: false,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，充值开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);

</script>
</body>
</html>